package com.lianbang.pharmacy.http.api

import cn.ubest.mvvmcore.bean.ListWrapper
import cn.ubest.mvvmcore.bean.ResultWrapper
import cn.ubest.mvvmcore.bean.Wrapper
import com.lianbang.pharmacy.bean.*
import retrofit2.http.*

/**
 * Created by maoqi on 2020/12/18.
 */
interface UserApi {
    //登陆
    @FormUrlEncoded
    @POST("login/login")
    suspend fun login(
        @Field("account") account: String,
        @Field("pwd") pwd: String
    ): ResultWrapper<LoginBean>

    //注册
    @FormUrlEncoded
    @POST("login/register")
    suspend fun register(
        @Field("account") account: String,
        @Field("pwd") pwd: String,
        @Field("conf_pwd") conf_pwd: String,
        @Field("real_name") real_name: String,
        @Field("phone") phone: String
    ): Wrapper

    //获取用户信息
    @POST("user_api/my")
    suspend fun getUser(): ResultWrapper<UserBean>

    //获取用户签到信息
    @POST("user_api/get_my_user_info")
    suspend fun userSignInfo(): ResultWrapper<UserSignBean>

    //签到
    @POST("user_api/user_sign")
    suspend fun sign(): ResultWrapper<SignBean>

    //用户地址列表
    @POST("user_api/user_address_list")
    suspend fun addressList(): ListWrapper<AddressListBean>

    //用户添加地址
    @FormUrlEncoded
    @POST("user_api/edit_user_address")
    suspend fun addOrChangeAddress(
        @Field("id") id: Int?,
        @Field("real_name") real_name: String,
        @Field("phone") phone: String,
        @Field("is_default") is_default: Int,
        @Field("province") province: String,
        @Field("city") city: String,
        @Field("district") district: String,
        @Field("detail") detail: String,
        @Field("post_code") post_code: String?
    ): Wrapper

    //用户删除地址
    @FormUrlEncoded
    @POST("user_api/remove_user_address")
    suspend fun deleteAddress(
        @Field("addressId") id: Int
    ): Wrapper


    //优惠券列表
    @POST("coupons_api/get_use_coupons")
    suspend fun couponList(): ListWrapper<CouponListBean>
}